package com.hz.service;

import com.hz.dao.DefaultdDao;
import com.hz.dao.PurchaseDao;
import com.hz.pojo.Defaultd;
import com.hz.pojo.Purchase;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


@Service
public class DefaultdService {
    @Autowired
    private DefaultdDao server;

    @Autowired
    private PurchaseDao purserver;

    public int add(Defaultd def) {
        int res = server.add(def);
        if (res > 0) {
            return res;
        } else {
            return 0;
        }

    }

    public List<Defaultd> listDef() {
        List<Defaultd> res = server.list();
        if (res != null) {
            return res;
        } else {
            return null;
        }
    }

    public int addDef(Purchase purchase) {
        int res = purserver.addDef(purchase);
        if (res != 0) {
            return res;
        } else {
            return 0;
        }
    }
}
